package lesson6;

public class Demo1 {
    public static void main(String[] args) {
        //continue与break的用法
        //continue作用是：结束本次循环,继续下次循环
        for (int i = 1; i <= 10; i++) {
            if (i == 5) {
                continue;
            }
            System.out.print(i + "  ");
        }
        System.out.println();
        System.out.println("***********************");
        //break作用:结束break所在的整个循环
        for (int m = 1; m <= 10; m++) {
            for (int i = 1; i <= 10; i++) {
                if (i == 5) {
                    break;
                }
                System.out.print(i + "  ");
            }
        }
        System.out.println();
        System.out.println("********************");
        //return作用:直接结束整个方法
        for (int m = 1; m <= 10; m++) {
            for (int i = 1; i <= 10; i++) {
                if (i == 5) {
                    return;
                }
                System.out.print(i + "  ");
            }
        }

        //遇到System.exit(0);
        //直接结束整个应用程序
        System.exit(1);
    }
}
